import React, { Component } from 'react';
import { Grid } from 'antd-mobile';
import { HotcateBox } from '../style'
import { withRouter } from 'react-router-dom'

@withRouter
class Hotcate extends Component {
  render() {
    return (
      <HotcateBox>
        <div className="title">精品分类</div>
        {/* Grid组件，需要自定义 */}
        {
          this.props.data && <Grid
            columnNum={3}
            data={this.props.data}
            itemStyle={{ height: '.6rem' }}
            renderItem={(val, index) => (
              <div style={{ marginTop: '.07rem' }}>{val.title}</div>
            )}
            onClick={row => console.log(row, this.props.history.push)}
          />
        }
      </HotcateBox>
    );
  }
}

export default Hotcate;
